﻿$filePath = “F:\ttt_distinctFieldNames.txt";
$content = Get-Content $filePath;
$lst = $content | %{$_.SubString(0,$_.Length-1)};
Write-Host $lst;
#format output
$format_src = "insert into hvr_action (CHN_NAME, GRP_NAME, TBL_NAME, ACT_NAME, ACT_PARAMETERS) values ('yy', 'SRC', '*', 'ColumnProperties', '/Name={0} /CaptureExpression=`"''510010''||{{{0}}}`"');";
$format_target = "insert into hvr_action (CHN_NAME, GRP_NAME, TBL_NAME, ACT_NAME, ACT_PARAMETERS) values ('yy', 'TGT', '*', 'Restrict', '/RefreshCondition=`"{{{0}}} like ''510010%''`"');";
$output_src = "";
$output_target = "";
foreach ($line in $lst)
{
     $str_src =  $format_src -F ($line.ToLower());
     $str_target =  $format_target -F ($line.ToLower());
     $output_src +=  ($str_src +[System.Environment]::NewLine);
     $output_target +=  ($str_target +[System.Environment]::NewLine);
}

$output_src >> "f:/hvr_column_insert_src.txt"
$output_target >> "f:/hvr_column_insert_target.txt"
